home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / develop / symcoff.arc / PLSHREAD.C < prev    next >
Text File  |  1988-11-07  |  2KB  |  44 lines

  1. static char *sccsid[]={"@(#)pldshread.c 2.1",
  2. "Copyright 1985 by Motorola Inc."};
  3. #include <stdio.h>
  4. #ifdef PCPORT
  5. #include "/pld/src/hd/pcport.h"      /*PC-PORT*/
  6. #endif
  7. #include "../hd/pfilehdr.h"
  8. #include "../hd/pscnhdr.h"
  9. #include "../hd/pldfcn.h"
  10.  
  11. #include "../hd/pldf_dcl.h"        /*PC-PORT*/
  12. /****************** PLDSHREAD ******************************************gs##*/
  13. /*                                                                        ##*/
  14. /*                                                                        ##*/
  15. /* Written by:  Michael Greenberg - MIL                                   ##*/
  16. /*                                                                        ##*/
  17. /* ACTION:                                                                ##*/
  18. /*      Read an indexed section header of a common object file.           ##*/
  19. /*                                                                        ##*/
  20. /* SYNOPSIS:                                                              ##*/
  21.       int pldshread(ldptr, sectindx, secthead)                          /*##*/
  22. /*    ----------------------------------------                            ##*/
  23. register LDFILE         *ldptr;                                         /*##*/
  24. register unsigned short sectindx;                                       /*##*/
  25. register SCNHDR         *secthead;                                      /*##*/
  26. /*                                                                        ##*/
  27. /*************************************************************************##*/
  28. {
  29.         register long   disp;
  30.  
  31.         if(sectindx > HEADER(ldptr).f_nscns)
  32.                 return(FAILURE);
  33.  
  34.         disp = OFFSET(ldptr) + FILHSZ + HEADER(ldptr).f_opthdr; /* skip headers */
  35.         disp += SCNHSZ * ((int) sectindx - 1); /* skip section headers */
  36.  
  37.         if(fseek(IOPTR(ldptr), disp, 0) != 0)
  38.                 return(FAILURE);
  39.         if(fread(secthead, SCNHSZ, 1, IOPTR(ldptr)) != 1)
  40.                 return(FAILURE);
  41.         return(SUCCESS);
  42. }
  43. /* Copyright 1985 by Motorola Inc. */
  44.